/*
 * @(#)CompanyImgServiceImpl.java 2011-12-07
 *
 * Copyright 2011 北龙中网（北京）科技有限责任公司. All rights reserved.
 */
package cn.shangjia.shop.service.impl;

import java.util.HashMap;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import cn.shangjia.common.dao.support.Page;
import cn.shangjia.common.domain.CompanyImg;
import cn.shangjia.common.domain.support.State;
import cn.shangjia.shop.config.Constants;
import cn.shangjia.shop.dao.CompanyImgDao;
import cn.shangjia.shop.domain.type.CompanyImgType;
import cn.shangjia.shop.service.CompanyImgService;

/**
 *
 * @author <a href="mailto:jinzhongze@knet.cn">jinzhongze</a>
 * @version 1.0, 2011-12-07 13:51:45
 * @since 1.0
 */
@Service
public class CompanyImgServiceImpl implements CompanyImgService {
	
	@Resource
	private CompanyImgDao companyImgDao;
	
	/*
	 * (non-Javadoc)
	 * @see cn.shangjia.shop.service.CompanyImgService#findHonorListByUserId(java.lang.String, int, int)
	 */
	@Override
	public Page<CompanyImg> findHonorListByUserId(String userId,  int pageNo, int pageSize) {
		
		Map<String,Object> params = new HashMap<String,Object>();
		
		params.put("type", CompanyImgType.HONOR);
		params.put("state", State.PASS);
		if (!Constants.siteSetting.getUserHonorVerifyFlag().booleanValue()) 
			params.put("auditting", State.AUDITING);
		params.put("userId", userId);
		
		Page<CompanyImg> page = new Page<CompanyImg>();
		page.setPageNo(pageNo);
		page.setPageSize(pageSize);
		page.setAutoCount(false);
		page.setTotalCount(companyImgDao.totalCount(params));
		
		return companyImgDao.selectListPage(page, params);
		
	}

}
